package com.test.service.impl;

import com.test.entity.User;
import com.test.mapper.UserMapper;
import com.test.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 用户登录查询用户信息
     * @param user
     * @return
     */
    @Override
    @Transactional(propagation = Propagation.SUPPORTS) //使查询也支持事务
    public User login(User user) {
        User userDb = userMapper.login(user);
        return userDb;
    }
}
